<?php

require_once 'luckyflagmodel.php';

/**
 * Description of taskstatusmodel
 *
 * @author David Morris
 */
class TaskStatusModel extends LuckyFlagModel
{
    
    public $columns = array(
        'status_name' => ''
    );
    
    public function __construct()
    {
        $this->table = 'tasks_statuses';
        parent::__construct();
    }
    
    /**
     * Returns an array of all available statuses with the status id being the key for it's respective name.
     * Sorted alphabetically; A-Z.
     * 
     * @return array 
     */
    public function getStatusesAsArray()
    {
        $return = array();
        $rows = $this->db->query('SELECT * FROM ? ORDER BY status_name', array($this->table));
        foreach($rows->result() as $row)
            $return[$row->status_id] = $row->status_name;
        return $return;
    }
}

